package com.lgl.scs.information.controller;

import com.lgl.scs.base.controller.BaseController;
import com.lgl.scs.information.service.AddressService;
import com.lgl.scsapi.system.model.PageData;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 地址处理
 */
@Slf4j
@RestController
@RequestMapping(value="/userIndex/address")
public class AddressController extends BaseController{
	@Resource(name="addressService")
	private AddressService addressService;
	
	//通过条件获取城市集合
	@RequestMapping(value="queryCityList",produces="application/json;charset=UTF-8")
	public Object queryCityList() {
		Map<String, Object> cityMap = new HashMap<String, Object>(1);
		PageData pd = this.getPageData();
		List<PageData> cityList = addressService.listAllCities(pd);
		cityMap.put("cityList", cityList);
		return cityMap;
	}
	//获取所有的省份信息
	@RequestMapping(value="listAllProvinces",produces="application/json;charset=UTF-8")
	public Object listAllProvinces() {
		return addressService.listAllProvinces(getPageData());
	}
	//获取所有的区县信息
	@RequestMapping(value="listArea",produces="application/json;charset=UTF-8")
	public Object listArea() {
		return addressService.listAllArea(getPageData());
	}
}